﻿using Application.Models;
using Application.Roles.Interfaces.Repositories;
using MediatR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Application.Roles.Queries.GetRoles
{
    public class GetRolesQueryHandle(IRoleReadRepository roleRead) : IRequestHandler<GetRolesQuery, IReadOnlyList<RoleDto>?>
    {
        public async Task<IReadOnlyList<RoleDto>?> Handle(GetRolesQuery request, CancellationToken cancellationToken)
        {
            return await roleRead.GetRoles(request.PageInfo);
        }
    }
}
